<?php
include('common.php');

$parent = $path;
if (substr($parent,-1) != '/') $parent.='/';
$nodes = array();
$h = opendir($parent);
while( ($v = readdir($h)) !== false)
{
	if ($v == '.' || $v == '..' ) continue;
	$nodes[] = array(
		'name'=>$v,
		'type'=> is_dir($parent.$v) ? 'folder' : get_file_type($v),
		'mtime' => date('Y-m-d H:i:s',filemtime($parent.$v))
	);
}
closedir($h);

exit_ok(array( 'root'=>$nodes));